require.config({
  paths : {
    "jquery" : '../3rd/jquery-1.11.1.min',
    "bootstrap" : "../../bootstrap/js/bootstrap.min",
    "Url" : '../common/Url'
  },
  shim : {
    "bootstrap" : {
      deps : [ 'jquery' ],
      exports : "bootstrap"
    }
  }
});
require([ "jquery", "bootstrap", "Url", "split-nav" ], function($, bootstrap, Url, splitNav) {
  $(function() {
    $("#prev").click(function() {
      submitPage(-1);
    });
    $("#next").click(function() {
      submitPage(1);
    });

    $("#searchByUid").click(function() {
      submitUid();
    });

    function submitPage(pageStep) {
      var curUrl = new Url();
      var paraPage = curUrl.getParam("p");
      var curPage;
      if (paraPage) {
        curPage = parseInt(paraPage);
      } else {
        curPage = 1;
      }
      curUrl.setParam("p", curPage + pageStep);
      var $Form = $("#query");
      $Form.attr("action", curUrl.toString());
      $Form.submit();
    }
    function submitUid() {
      var curUrl = new Url();
      var uid = $("#u").val();
      curUrl.setParam("u", uid);
      var $Form = $("#query");
      $Form.attr("action", curUrl.toString());
      $Form.submit();
    }
  });
});